package shop;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class CreateProductScreen implements Screen{
	private Console console;
	private CreateProduct CP;

	@Autowired
	public CreateProductScreen(CreateProduct cP, Console c) {
		super();
		CP = cP;
		console = c;
	}

	public void show(){
		console.println("---------Create Product Screen---------");
		console.printf("Please input ID: ");
		String id = console.readLine();
		console.printf("Please input Name: ");
		String name = console.readLine();
		console.printf("Please input Price: ");
		String price = console.readLine(); 
		CP.createProduct(new Product(Long.valueOf(id), name, Double.valueOf(price)));
	}

}
